
<template>
  <view class="types">
     <view :class="cur==1?'type-warp cur-type':'type-warp' "  @click="setType(1)"> <view class="type type1"> </view> 高层 </view>
       <view :class="cur==2?'type-warp cur-type':'type-warp' "  @click="setType(2)"> <view class="type type2"> </view> 公寓 </view>
   
      <view :class="cur==3?'type-warp cur-type':'type-warp' "  @click="setType(3)"> <view class="type type3"> </view> 别墅 </view>
        <view :class="cur==4?'type-warp cur-type':'type-warp' "  @click="setType(4)"> <view class="type type4"> </view> 单家 </view>
     
       <view :class="cur==5?'type-warp cur-type':'type-warp' "  @click="setType(5)"> <view class="type type5"> </view> 写字楼 </view>
      <view :class="cur==6?'type-warp cur-type':'type-warp' "  @click="setType(6)"> <view class="type type6"> </view> 商铺 </view> 
  </view>
</template>
<script>
export default {
  components: {},
  data() {
    return {
      cur:1,
    };
  },
  mounted() {
      var publishInfo = this.$store.state.publishInfo
      console.log(publishInfo);
      this.cur  = publishInfo.propertyType
  },
  methods: {
    setType (index) {
      console.log(index);
      this.cur = index;
      this.$store.dispatch("asyncPublishInfo",{ propertyType :index});
    },
  },
};
</script>  

<style >
  
.types{
  display: flex;
  flex-wrap: wrap ; 
  color: #fff;
  font-size: 12px;
  width: 300px;
}
.type-warp{
  background: #ccc;
  border-radius: 20px;
  width: 28%;
  height: 70px;
  margin: 10px;
  display:flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 10px 0;
}
.cur-type{
   background: #FFD851;
  border-radius: 20px;
}
.type{
  width: 50px;
  height: 50px;
}
.type1{
    background: url(http://house-detective.oss-cn-guangzhou.aliyuncs.com/t1.png) center center / 100% 100%;
}
.type2{
    background: url(http://house-detective.oss-cn-guangzhou.aliyuncs.com/t2.png) center center / 100% 100%;
}
.type3{
    background:  url(http://house-detective.oss-cn-guangzhou.aliyuncs.com/t3.png) center center / 100% 100%;
}
.type4{
    background: url(http://house-detective.oss-cn-guangzhou.aliyuncs.com/t4.png)center center / 100% 100%;
}
.type5{
    background:  url(http://house-detective.oss-cn-guangzhou.aliyuncs.com/t5.png) center center / 100% 100%;
}
.type6{
    background:  url(http://house-detective.oss-cn-guangzhou.aliyuncs.com/t6.png) center center / 100% 100%;
}

</style>